package chapter4;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description:  十进制转十六进制
 * Date:2021/4/2
 * ***************************************************************
 */
public class exc4_11 {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		System.out.print("Enter a decimal value (0-15):  ");
		int n=input.nextInt();
		if(n>=0&&n<=15) {
			
			if(n>=0&&n<=9) {
				System.out.print("The hex value is "+n);
			}else {
				System.out.printf("The hex value is %c ", (char)((int)'A'+n-10));
			}
			
		}else {
			System.out.print("This is an invalid input.");
		}
		
		
	}

}
